<?php



namespace App\Http\Requests\ApiV2;

use App\Http\Requests\Company\BaseRequest;
use Carbon\Carbon;
use Illuminate\Support\Facades\Auth;

class TransferRequest extends BaseRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'bank_name' => 'required|max:20',
            'account_id' => 'required',
            'account_name' => 'required',

        ];
    }

    public function messages()
    {
        return [
            'order_id.required'=>__('请输入订单号'),
            'bank_name.required' => __('请输入银行名字'),
            'account_id.required' => __('请输入转款账户'),
            'account_name.required' => __('请输入转款用户'),
        ];
    }

    public function filldata()
    {
        $user  = Auth::user();
        return [
            'user_id'=>$user['id'],
            'company_id'=>(int)$this->input('company_id'),
            'order_id'=>(int)$this->input('order_id'),
            'account_id'=>(string)$this->input('account_id'),
            'account_name' =>(string)$this->input('account_name'),
            'bank_name' =>(string)$this->input('bank_name'),

        ];
    }
}
